﻿using MediatR;
using Rabbit.Domain;
using Rabbit.ErCode;
using Rabbit.lnfarnum;
using Rabbit.Read.API.GetRepository.Commders;

namespace Rabbit.Read.API.GetRepository.CommdHenders
{
    /// <summary>
    /// 类型名称
    /// </summary>
    public class GetMerchancommdHaners : IRequestHandler<GetMerchancommder, APIResult<List<Merchan>>>
    {

        private readonly IBaseRepository<Merchan> baseRepository;

        public GetMerchancommdHaners(IBaseRepository<Merchan> baseRepository)
        {
            this.baseRepository = baseRepository;
        }

        public Task<APIResult<List<Merchan>>> Handle(GetMerchancommder request, CancellationToken cancellationToken)
        {
            APIResult<List<Merchan>> result = new APIResult<List<Merchan>>();


            result.Code =ReCode.查询成功;
            result.Mage =ReCode.查询成功.ToString();

            var lsit = baseRepository.GetAll();

            result.Data =lsit.ToList();
            return Task.FromResult(result);
        }
    }
}
